package org.fenixsoft.jvm.chapter8.my;

/**
 * 字段不参与多态
 * @author zzm
 */
public class FieldHasNoPolymorphic2 {

    static class Father {
        public int money = 1;

        public int getMoney() {
            return money;
        }
    }

    static class Son extends Father {
        public int money = 3;

        @Override
        public int getMoney() {
            return money;
        }
    }

    public static void main(String[] args) {
        Father gay = new Son();
        System.out.println("This gay has $" + gay.money);
        System.out.println("This gay has $" + gay.getMoney());
    }

    /**
     * This gay has $1
     * This gay has $3
     */
}
